//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class ColorSchemeAndMapping : IOfficeXmlSerializable
    {
        private ColorMapping colorMapping;
        private ColorScheme colorScheme;

        public ColorScheme ColorScheme
        {
            get { return colorScheme; }
            set { colorScheme = value; }
        }

        public ColorMapping ColorMapping
        {
            get { return colorMapping; }
            set { colorMapping = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("extraClrScheme"))
            {
                ColorScheme = c.ReadElement<ColorScheme>();
                ColorMapping = c.ReadOptionalElementAs<ColorMapping>("clrMap");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("extraClrScheme"))
            {
                c.WriteElement(ColorScheme);
                c.WriteOptionalElementAs(ColorMapping, "clrMap");
            }
        }

        #endregion
    }
}